{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 17 序列"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【选择】下列不是序列的是：（ ）\n",
    "\n",
    "A.列表  \n",
    "B.元组  \n",
    "C.集合  \n",
    "D.字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：C"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【填空】请写出下列语句的运行结果：（ ）  \n",
    "`\n",
    "myTuple = tuple(range(10))\n",
    "print(myTuple[1:9:2])`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：(1, 3, 5, 7)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【选择】下面哪些操作是序列都具有的？（ ）\n",
    "\n",
    "A.迭代  \n",
    "B.索引  \n",
    "C.拆包  \n",
    "D.以上都是"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【填空】请写出下列语句的运行结果：（ ）   \n",
    "`\n",
    "x = 1,3,7\n",
    "print(x*3)`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：(1, 3, 7, 1, 3, 7, 1, 3, 7)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【填空】请写出下列语句的运行结果：（ ）  \n",
    "`\n",
    "myList = [37,44,5,626,8]\n",
    "myList.sort(key=lambda x:-len(str(x)))\n",
    "print(myList)`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：[626, 37, 44, 5, 8]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.【填空】请写出下列语句的运行结果：（ ）  \n",
    "`\n",
    "str1 = \"data\"\n",
    "lst = list(enumerate(str1))\n",
    "print(lst)`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：[(0, 'd'), (1, 'a'), (2, 't'), (3, 'a')]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.【选择】下列Python语句的运行结果是：（ ）  \n",
    "`\n",
    "lst = [1,2,3]\n",
    "tpl = 1,2,3\n",
    "print(list(zip(lst,tpl)))`\n",
    "\n",
    "A.[(1, 1), (2, 2), (3, 3)]  \n",
    "B.([1,1],[2,2],[3,3])  \n",
    "C.[2,4,6]  \n",
    "D.(2,4,6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：A"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
